package com.epam.facebook_client.processor;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

import com.epam.facebook_client.api.API;
import com.epam.facebook_client.content.contract.AppContract;
import com.epam.facebook_client.parser.FbJsonParser;

public class FriendsProcessor extends AbstractProcessor {

	public static final String ACTION = "action_friends";

	protected static final String TAG = FriendsProcessor.class.getSimpleName();

	public FriendsProcessor(Context context) {
		super(context);
	}

	@Override
	public Bundle executeGet(Intent intent) throws Exception {
		FbJsonParser parser = new FbJsonParser(getContext());
		writeInDB(API.FRIENDS, parser);
		return null;
	}

	@Override
	public Bundle executeDelete(Intent intent) throws Exception {
		getContext().getContentResolver().delete(getUri(), null, null);
		return executeGet(intent);
	}

	@Override
	public Bundle executePost(Intent intent) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected Uri getUri() {
		return AppContract.FriendsColumns.CONTENT_URI;
	}

}
